//
//  WACodeIconValueTransformer.m
//  WeatherApp
//
//  Created by Yuliya Grasevych on 30.07.14.
//  Copyright (c) 2014 Yuliya Grasevych. All rights reserved.
//

#import "WACodeIconValueTransformer.h"

//NSString *const kWeatherIconSet = @"cloud_weather";
NSString *const kWeatherIconSet = @"sketch_weather";

@implementation WACodeIconValueTransformer

+(Class)transformedValueClass
{
    return [NSImage class];
}

-(id)transformedValue:(id)value
{
    NSString *imageName = [NSString stringWithFormat:@"na_%@", kWeatherIconSet];
    NSImage *image = [NSImage imageNamed:imageName];
    NSInteger code = [value integerValue];
    if (code >= 0) {
        
        NSString *imageName = [NSString stringWithFormat:@"%02ld_%@", (long)code, kWeatherIconSet];
        image = [NSImage imageNamed:imageName];
    }
    return image;
}

@end
